-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nokia srl prompt stripping #3531
Conversation
@jeffkala Added some tests and converted the one method to a private method (as more consistent with standard Netmiko behavior). |
netmiko/nokia/nokia_srl.py
Outdated
def _strip_context_items(self, a_string: str) -> str: | ||
"""Strip NokiaSRL-specific output. | ||
|
||
Nokia will put extra context is line 1 of the prompt, such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nokia will put extra context is line 1 of the prompt, such as: | |
Nokia will put extra context in the 1st line of the prompt, such as: |
netmiko/nokia/nokia_srl.py
Outdated
@@ -53,6 +53,32 @@ def session_preparation(self) -> None: | |||
self.disable_paging(command=command, cmd_verify=True, pattern=r"#") | |||
self.set_base_prompt() | |||
|
|||
def strip_prompt(self, *args: Any, **kwargs: Any) -> str: | |||
"""Strip the line1 of multiline prompt from the output.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this statement correct about the 1st line? Shouldn't the strip tackle the two lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still calling super which I'd assume would strip the original prompt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the docstrings, the super()
call will get rid of A:srl1#
.
The _strip_context_items
call will get rid of things like --{ running }...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see, by "prompt" you mean only one line of the SR Linux prompt.
Ok, lgtm
2bdb523
to
25be4a9
Compare
No description provided.